home *** CD-ROM | disk | FTP | other *** search
- /*
- * ADDGTEXT.C
- */
-
- #include "newlook.h"
-
- extern struct TextFont *OpenFont(struct TextAttr *);
- extern void CloseFont(struct TextFont *);
- extern LONG IntuiTextLength(struct IntuiText *);
-
- struct IntuiText *AddGText(g,l,r)
- struct Gadget *g;
- STRPTR l,r;
- {
- struct IntuiText *it= (struct IntuiText *)NULL;
- struct TextFont *tf;
-
- SHORT tx, ty; /* text position */
-
- tx= ( (g->GadgetType == STRGADGET) ? 14:10 );
-
- if(tf= (struct TextFont *)OpenFont(&Topaz80))
- { ty= (g->Height-tf->tf_Baseline)/2;
- CloseFont(tf);
- }
- else ty= (g->Height-6)/2; /* `known' topaz80 dimensions */
-
- if(l && *l)
- { if(it= CreateIText(-tx,ty,l))
- { MoveIText(it,-IntuiTextLength(LastIText(it)),0);
- LastIText(it)->NextText= g->GadgetText;
- g->GadgetText= it;
- }
- }
- if(r && *r)
- { if(it= CreateIText(g->Width+tx,ty,r))
- { LastIText(it)->NextText= g->GadgetText;
- g->GadgetText= it;
- }
- }
- return it;
- }
-